home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
funcom 2000 Presskit
/
000721_1312 (fun.com).iso
/
funcom.dir
/
00025_Script_Set Color behavior
< prev
next >
Wrap
Text File
|
2000-07-20
|
2KB
|
50 lines
-- Set Color behavior
-----------------------------------------------------------
-- This behavior sets the color of a shape sprite in
-- response to a sliderMove message from the slider
-- behavior. The message also contains a value between 0
-- and 100 representing the slider's current position.
--
-- You attach this behavior to a shape sprite.
--
-- David Benman 11/97
-----------------------------------------------------------
-- pControlButtonName - The name of the button that
-- controls this behavior.
property pControlButtonName
-- This handler determines which control messages the
-- behavior responds to.
on beginSprite me
set pControlButtonName to "Vertical Slider"
end
-- This handler responds to a sliderMove message by
-- changing the sprite's color. The color changes only
-- when the behavior sending the message is the controlling
-- button for this behavior.
on sliderMove me, messageSenderName, ratio
-- Sets the color of the current sprite to a palette
-- position between 36 and 179. These palette positions
-- contain identical colors in the Netscape, Macintosh,
-- and Windows palettes.
if messageSenderName = pControlButtonName then
set startColor to 36
set endColor to 179
set totalColors = endColor - startColor
set currentColor to totalColors * (ratio/100)
set colorPosition to currentColor + startColor
set newColor to integer(colorPosition)
set currentSprite to the spriteNum of me
set the forecolor of sprite currentSprite to newColor
end if
end